package com.ruoyi.quartz.util;

import java.util.Set;
import java.util.concurrent.TimeUnit;

import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.spring.SpringUtils;

public class JedisUtilNew {
	public static String set(String key, String value) {
		SpringUtils.getBean(RedisCache.class).setCacheObject(key, value);
		return "";
	}

	public static Long setexpire(String key, String value, Integer seconds) {
		SpringUtils.getBean(RedisCache.class).setCacheObject(key, value, seconds, TimeUnit.SECONDS);
		return 0L;
	}

	public static Long expire(String key, Integer seconds) {
		SpringUtils.getBean(RedisCache.class).expire(key, seconds);
		return 0L;
	}

	public static String get(String key) {
		String result = SpringUtils.getBean(RedisCache.class).getCacheObject(key);
		return result;
	}

	public static Boolean exists(String key) {
		Boolean result = SpringUtils.getBean(RedisCache.class).hasKey(key);
		return result;
	}

	public static Set<String> keysByPre(String pre) {
		Set<String> result = (Set<String>) SpringUtils.getBean(RedisCache.class).keys(pre + "*");
		return result;
	}

}
